import "package:ct_pa_majordomo/config/theme_vars.dart";
import "package:flutter/cupertino.dart";
import "package:flutter/material.dart";
import './tab_pane.dart';

class AddCard extends StatefulWidget {
  final Map lockInfo;
  const AddCard({super.key,  required this.lockInfo});

  @override
  State<StatefulWidget> createState() => _AddCardState();

}

class _AddCardState extends State<AddCard> {
  final List _tabs = ["限时", "永久"];
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: _tabs.length,
      child: Scaffold(
        appBar: AppBar(
          iconTheme: const IconThemeData(color: Colors.white),
          title: const Text("添加IC", style: TextStyle(color: Colors.white),),
          centerTitle: true,
          backgroundColor: ThemeVars.colorPrimaryDark,
          leading: IconButton(
            icon: const Icon(Icons.arrow_back_ios_new),
            onPressed: () {
              Navigator.pop(context);
            },
          ),
          bottom: PreferredSize(
              preferredSize: const Size.fromHeight(48),
              child: Material(
                color: Colors.white,
                child: TabBar(
                  // isScrollable: true,
                  // tabAlignment: TabAlignment.center,
                  tabs: List.generate(_tabs.length, (index) => Tab(text: _tabs[index],)),
                ),
              )
          ),
        ),
        body: TabBarView(
            children: [
              TabPane(usageTimeType: UsageTimeType.usage, lockInfo: widget.lockInfo,),
              TabPane(usageTimeType: UsageTimeType.forever, lockInfo: widget.lockInfo,),
            ]
        ),
      ),
    );
  }

}